<?
if(!groupExistsId($_GET['id'])) {
	echo "That doesn't exist!<br>
<a href=\"" . $_SERVER['SCRIPT_NAME'] . "\"><- Back</a>
";
die;
}
$group =&new PeopleGroup($_GET['id']);
?>
<table border="0" align="center">
<tr><td colspan="2" align="center">
<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="hidden" name="action" value="changename">
<input type="hidden" name="gid" value="<? echo $group->info['people_group_id'] ?>">
Name: 
<input type="input" name="name" value="<? echo $group->info['people_group_name'] ?>">
<br>
<input type="submit" value="Change Name">
</form>
</td></tr>
<tr><th colspan="2" align="center">
Users
</th></tr>
<tr><td>
<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="hidden" name="action" value="addtogroup">
<input type="hidden" name="gid" value="<? echo $group->info['people_group_id'] ?>">
<select name="addtogroup">
<option value="0">-Select A User-</option>
<?
$ar=getUserList();
foreach($ar as $info) {
	if(!$group->isInGroup($info['people_id'])) {
		echo "
<option value=\"" . $info['people_id'] . "\">" . stripslashes($info['people_firstname']) . " " . stripslashes($info['people_lastname']) . "</option>";
	}
}
?>
</select>
<br><input type=submit value="Add User">
</form>
</td><td>
<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="hidden" name="action" value="removefromgroup">
<input type="hidden" name="gid" value="<? echo $group->info['people_group_id'] ?>">
<select name="removefromgroup">
<option value="0">-Select A User-</option>
<?
$ar=$group->userList();
foreach($ar as $uid) {
	$user=new Person($uid);
	echo "
<option value=\"" . $uid . "\">" . stripslashes($user->firstname) . " " . stripslashes($user->lastname) . "</option>";
}
?>
</select>
<br><input type=submit value="Remove User">
</form>
</td></tr>
<tr><td colspan="2" style="border-bottom: 1px solid #000000;">&nbsp;</td></tr>
<tr><th colspan=2>Access and Navigation</th></tr>
<tr><td colspan="2">
<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="hidden" name="action" value="changeaccess">
<input type="hidden" name="gid" value="<? echo $group->info['people_group_id'] ?>">
<select name="page">
<option value="0">-Select A Page-</option>
<?
$access=getPageList();
foreach($access as $val) {
	echo "
<option value=\"" . $val['page_id'] . "\">" . stripslashes(pageId2Name($val['page_id'])) . "</option>";
}
?>
</select>
<select name="access">
<option value="default">Default Access</option>
<option value="0">Cannot Access</option>
<option value="1">Can Access</option>
</select>
<input type="submit" value="Change Access">
</form>
</td></tr>
<tr><td>
<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="hidden" name="action" value="addtonav">
<input type="hidden" name="gid" value="<? echo $group->info['people_group_id'] ?>">
<select name="page">
<option value="0">-Select A Page-</option>
<?
$access=getPageList();
foreach($access as $val) {
	if(!$group->isInNav_id($val['page_id'])) {
	echo "
<option value=\"" . $val['page_id'] . "\">" . stripslashes(pageId2Name($val['page_id'])) . "</option>";
} }
?>
</select>
<br>
<input type="submit" value="Add To Navigation">
</form>
</td><td>
<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="hidden" name="action" value="removenav">
<input type="hidden" name="gid" value="<? echo $group->info['people_group_id'] ?>">
<select name="page">
<option value="0">-Select A Page-</option>
<?
$access=getPageList();
foreach($access as $val) {
	if($group->isInNav_id($val['page_id'])) {
	echo "
<option value=\"" . $val['page_id'] . "\">" . stripslashes(pageId2Name($val['page_id'])) . "</option>";
} }
?>
</select>
<br>
<input type="submit" value="Remove From Navigation">
</form>

</td></tr></table>
